/**
* @author Ashish Gupta
* CVSSP, University of Surrey
* Copyright (c) 2010 Ashish Gupta
* All rights reserved.
*/
/**
 * 
 */
package classifier;

import java.io.IOException;

/**
 * @author Ashish
 *
 */
public class SupportVectorMachine {
	private String codebookFilename = null;
	private String svmmodelFilename = null;
	private String svmpredictionFilename = null;
	private String parameters = "";
	private String progLocation;                                 
	
	/**
	 * @param progLocation
	 */
	public SupportVectorMachine(String progLocation) {
		super();
		this.progLocation = progLocation;
	}

	/**
	 * @throws IOException
	 */
	public void computeSVMModel(String codebookFilename) throws IOException{
		this.setCodebookFilename(codebookFilename);
		String progName = "svm_learn";
		String cmd = progLocation + progName + " " + codebookFilename + " " + this.svmmodelFilename;
		Runtime.getRuntime().exec(cmd);
	}
	
	/**
	 * @throws IOException
	 */
	public void computeSVMPred(String codebookFilename) throws IOException{
		String progName = "svm_classify";
		String	cmd = progLocation + progName + " " + codebookFilename + " " + this.svmmodelFilename + " " + this.svmpredictionFilename;
		Runtime.getRuntime().exec(cmd);
	}
	/**
	 * @param codebookFilename the codebookFilename to set
	 */
	public void setCodebookFilename(String codebookFilename) {
		this.codebookFilename = codebookFilename;
	}
	/**
	 * @return the codebookFilename
	 */
	public String getCodebookFilename() {
		return codebookFilename;
	}
	/**
	 * @param svmmodelFilename the svmmodelFilename to set
	 */
	public void setSvmmodelFilename(String svmmodelFilename) {
		this.svmmodelFilename = svmmodelFilename;
	}
	/**
	 * @return the svmmodelFilename
	 */
	public String getSvmmodelFilename() {
		return svmmodelFilename;
	}
	/**
	 * @param svmpredictionFilename the svmpredictionFilename to set
	 */
	public void setSvmpredictionFilename(String svmpredictionFilename) {
		this.svmpredictionFilename = svmpredictionFilename;
	}
	/**
	 * @return the svmpredictionFilename
	 */
	public String getSvmpredictionFilename() {
		return svmpredictionFilename;
	}

	/**
	 * @param parameters the parameters to set
	 */
	public void setParameters(String parameters) {
		this.parameters = parameters;
	}

	/**
	 * @return the parameters
	 */
	public String getParameters() {
		return parameters;
	}
}
